package com.scst.mapper;

import com.github.pagehelper.Page;
import com.scst.annoation.AutoFill;
import com.scst.dto.DishPageQueryDTO;
import com.scst.entity.Dish;
import com.scst.enumeration.OperationType;
import com.scst.vo.DishVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishMapper {

     @AutoFill(OperationType.INSERT)
    void insert(Dish dish);

    @Select("select count(id) from dish where category_id = #{categoryId}")
    Integer countByCategoryId(Long categoryId);

    Page<DishVO> pageQuery(DishPageQueryDTO dishPageQueryDTO);
    @Select("select * from dish where id=#{id}")
    Dish getById(Long id);
    @Delete("delete from dish where id =#{id}")
    void deteleById(Long id);

    void update(Dish dish);

    List<Dish> list(Dish dish);
}
